<div class="layui-form layui-row" lay-filter="form_banner">
  <div class="layui-card-body layui-row layui-col-space10">
    <div class="layui-form-item">
      <label class="layui-form-label form-required">上传图片</label>
      <div class="layui-input-block">
        <div id="banner_image"></div>
      </div>
    </div>

    <div class="layui-form-item">
      <div class="layui-inline">
        <label class="layui-form-label">跳转链接</label>
        <div class="layui-input-inline">
          <script type="text/html" template>
            <input type="hidden" name="id" value="{{ d.params.id || ''}}">
            <input type="text" name="jump_url" value="{{ d.params.jump_url || '' }}" placeholder="请输入跳转链接"
                   autocomplete="off" class="layui-input">
          </script>
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-mid layui-word-aux">
          链接以 http:// 或 https:// 开头
        </div>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-inline">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
          <script type="text/html" template>
            <input type="number" name="sequence" value="{{ d.params.sequence || 0 }}" lay-verify="required"
                   placeholder="请输入排序" autocomplete="off" class="layui-input">
          </script>
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-mid layui-word-aux">
          数字越大越靠前
        </div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">备注</label>
      <div class="layui-input-inline" style="width: 300px">
        <script type="text/html" template>
          <input class="layui-input" type="text" name="remark" value="{{d.params.remark || ''}}"/>
        </script>
      </div>
    </div>

  </div>

  <div class="layui-card-body layui-row layui-col-space10">
    <div class="layui-col-md6">
      <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
          <a class="layui-btn" lay-submit lay-filter="submit_banner">保存</a>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/html" template lay-done="layui.data.done(d.params)"></script>

<script>
  layui.data.done = function (obj) {

    layui.use(['fox_upload'], function () {
      let $ = layui.$
        , admin = layui.admin
        , fox_upload = layui.fox_upload

      fox_upload.render({
        elem: '#banner_image'
        , name: 'image_url'
        , url: 'agent-admin/banners/image'
        , text: '上传BANNER'
        , value: obj.image_url
        , headers: {
          Authorization: admin.getAccessToken('Bearer'),
        }
      })
    })
  }
</script>
